package modularity.passiveDrift;

public class ConnectionGene {

	private int fromGene, toGene;

	public ConnectionGene(int from, int to){
		this.fromGene = from;
		this.toGene = to;
	}

	public int getFromGene(){
		return fromGene;
	}

	public int getToGene(){
		return toGene;
	}

	public boolean equals(Object other){

		//class instance comparison
		if(! (other instanceof ConnectionGene))
			return false;

		ConnectionGene otherConnection = (ConnectionGene) other;

		//we do not care about the direction of the connection.
		return (this.fromGene == otherConnection.fromGene && this.toGene == otherConnection.toGene) 
				|| (this.fromGene == otherConnection.toGene && this.toGene == otherConnection.fromGene);
	}

	public boolean containsNodeGene(int gene) {
		return fromGene == gene || toGene == gene;
	}

}
